<template>
  <div class="goods-desc-container">
    <h3 class="title">{{ goodsDesc.title }}</h3>
    <hr>
    <div class="content" v-html="goodsDesc.content"></div>
  </div>
</template>

<script>
export default {
  data(){
    return {
      goodsDesc: {} // 商品的描述内容
    }
  },
  created() {
    this.getGoodsDesc();
  },
  methods: {
    async getGoodsDesc(){
      const { data } = await this.$http.get("/api/goods/getdesc/" + this.id);
      if( data.status === 0 )
        this.goodsDesc = data.message[0];
    }
  },
  props: ['id']
}
</script>

<style lang="scss">
  .goods-desc-container{
    padding: 0 5px;
    .title{
      font-size: 16px;
      color: #0062cc;
      text-align: center;
    }
    .content{
      // 要使得这个css生效需要将style标签中的 scope 属性删除, 否则不生效
      img{
        width: 100%;
      }
    }
  }
</style>